#ifndef L_VERSION_H
#define L_VERSION_H

/* The default version definition.
 * Note: Change this when version update.
 * Note: Project post-build event will duplicate a copy of llib.lib
 *       and renamed with version tag append into llib\lib\ directory.
 *       The version infomation is fetched here, so ALWAYS be careful.
 */
#define DEFAULT_L_VERSION   1120206

/* Library version will be set to DEFAULT_L_VERSION by default.
 * (When L_VERSION is not defined)
 */
#ifndef L_VERSION
#define L_VERSION           DEFAULT_L_VERSION
#endif


/* The helper macro */
/* 1.stringize */
#define L_STRINGIZE(X)      L_DO_STRINGIZE(X)
#define L_DO_STRINGIZE(X)   #X
/* 2.join */
#define L_JOIN(X,Y)         L_DO_JOIN(X,Y)
#define L_DO_JOIN(X,Y)      L_DO_JOIN2(X,Y)
#define L_DO_JOIN2(X,Y)     X##Y


/* The major and minor version, version string, version date defined above. */
#undef L_VERSION_MAJOR
#undef L_VERSION_MINOR
#undef L_VERSION_STR
#undef L_VERSION_DATE

#if L_VERSION == 1111225
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     111225
#   define  L_VERSION_DATE      "2011-12-25"
#elif L_VERSION == 1111227
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     111227
#   define  L_VERSION_DATE      "2011-12-27"
#elif L_VERSION == 1120104
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     120104
#   define  L_VERSION_DATE      "2012-01-04"
#elif L_VERSION == 1120118
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     120118
#   define  L_VERSION_DATE      "2012-01-18"
#elif L_VERSION == 1120130
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     120130
#   define  L_VERSION_DATE      "2012-01-30"
#elif L_VERSION == 1120206
#   define  L_VERSION_MAJOR     1
#   define  L_VERSION_MINOR     120206
#   define  L_VERSION_DATE      "2012-02-06"
#else
#error "Undefined llib version!"
#endif

#define  L_VERSION_STR      L_JOIN(L_STRINGIZE(L_VERSION_MAJOR),L_JOIN(".",L_STRINGIZE(L_VERSION_MINOR)))


/* The library file macro definition. */
#define L_LIB_BINARY_NAME               "llib"
#if defined(_DEBUG)
#   define  L_LIB_BINARY_DEBUG_FALG     "_d"
#else
#   define  L_LIB_BINARY_DEBUG_FALG     ""
#endif

#define L_LIB_BINARY_FILE   L_JOIN(L_LIB_BINARY_NAME,   \
                            L_JOIN("_",                 \
                            L_JOIN(L_VERSION_STR,       \
                            L_JOIN(L_LIB_BINARY_DEBUG_FALG,".lib"))))


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Individual llib module version management.
 * Note: update this when version of any module and whole library changes.
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* The undefined version : using for eliminate modules and other */
#define L_VERSION_MODULE_UNDEFINED              000000

/* Module: AppFramework */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_APP_FRAMEWORK       111225
#endif

/* Module: BvTree */
#if L_VERSION == 1120104
#   define L_VERSION_MODULE_BV_TREE             120104
#elif L_VERSION >= 1120118
#   define L_VERSION_MODULE_BV_TREE             120118
#endif

/* Module: CollisionDetector */
#if L_VERSION == 1120104
#   define L_VERSION_MODULE_COLLISION_DETECTOR  120104
#elif L_VERSION >= 1120118
#   define L_VERSION_MODULE_COLLISION_DETECTOR  120118
#endif

/* Module: CollisionResult */
#if L_VERSION >= 1120104 && L_VERSION < 1120130
#   define L_VERSION_MODULE_COLLISION_RESULT    120104
#elif L_VERSION >= 1120130
#   define L_VERSION_MODULE_COLLISION_RESULT    120130
#endif

/* Module: DisjointSet */
#if L_VERSION >= 1120130
#   define L_VERSION_MODULE_DISJOINT_SET        120130
#endif

/* Module: Equation */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_EQUATION            111225
#endif

/* Module: IrregularTable */
#if L_VERSION >= 1120130
#   define L_VERSION_MODULE_IRREGULAR_TABLE     120130
#endif

/* Module: Macros */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_MACROS              111225
#endif

/* Module: Math */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_MATH                111225
#endif

/* Module: Random */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_RANDOM              111225
#endif

/* Module: Scene */
#if L_VERSION >= 1120206
#   define L_VERSION_MODULE_SCENE               120206
#endif

/* Module: SceneAuxObj */
#if L_VERSION >= 1120206
#   define L_VERSION_MODULE_SCENE_AUX_OBJ       120206
#endif

/* Module: SceneObj */
#if L_VERSION == 1120104
#   define L_VERSION_MODULE_SCENE_OBJ           120104
#elif L_VERSION == 1120118
#   define L_VERSION_MODULE_SCENE_OBJ           120118
#elif L_VERSION == 1120130
#   define L_VERSION_MODULE_SCENE_OBJ           120130
#elif L_VERSION >= 1120206
#   define L_VERSION_MODULE_SCENE_OBJ           120206
#endif

/* Module: Simulator */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_SIMULATOR           111225
#endif

/* Module: Triangle */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_TRIANGLE            111225
#endif

/* Module: TriMesh */
#if L_VERSION == 1111225
#   define L_VERSION_MODULE_TRI_MESH            111225
#elif L_VERSION >= 1111227
#   define L_VERSION_MODULE_TRI_MESH            111227
#endif

/* Module: Type */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_TYPE                111225
#endif

/* Module: Utility */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_UTILITY             111225
#endif

/* Module: Vectors */
#if L_VERSION >= 1111225
#   define L_VERSION_MODULE_VECTORS             111225
#endif


#endif